BGREP

Section: User Commands (1)
Updated: Georgia Tech
Index Return to Main Contents
 

NAME

bgrep - search a file for one or more simple strings  

SYNOPSIS

bgrep [ options ] string-list [ files ]  

DESCRIPTION

Bgrep (Boyer-Moore grep) is program patterned after fgrep(1). It uses the Boyer-Moore string searching algorithm, which actually gets faster as the length of the pattern to be searched for increases. Bgrep searches for plain strings (separated by newlines in the string-list argument), not regular expressions in the style of grep.

The following options are recognized:

-v
All lines but those matching are printed.
-x
(Exact) only lines matched in their entirety are printed.
-c
Only a count of the matching lines are printed. This is the total count, across all the input files.
-i or -y
Ignore case when trying to match a line. Both versions of this option are accepted for compatibility with grep on different versions of Unix.
-l
Only the names of files with matching lines are printed (once), separated by newlines.
-n
Each line is preceded by its relative line number within the file.
-s
Silent mode: No output is generated (except error messages). This is useful for just checking the exit status.
-e string
Same as a simple string argument, but useful when the string begins with a -.
-f file
The strings to be searched for are read from file.

The arguments to the -e and -f options must be given as separate program arguments, i.e. separated by white space.

Bgrep catches conflicting arguments (e.g. -v and -x) and complains.  

SEE ALSO

ed(1), sed(1), grep(1), sh(1)  

DIAGNOSTICS

Exit status 0 if any matches were found, 1 if none, 2 for syntax errors on the command, or if any files could not be opened (even if matches were found).  

BUGS

Input lines and the strings to be searched for are limited to 256 characters. Longer input lines are truncated.

Bgrep will not search for any more than 120 different strings.

Uses the <stdio.h> package, which slows it down some. Nonetheless, in the usual case, it is 10% to 20% faster than fgrep(1).  

AUTHORS

Roy Mongiovi (gatech!gitpyr!roy) coded the guts of the Boyer-Moore algorithm, while Arnold Robbins (gatech!arnold) wrote the code to do all the rest of the work, and the man page.


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
DIAGNOSTICS
BUGS
AUTHORS

This document was created by man2html, using the manual pages.
Time: 04:48:25 GMT, August 26, 2022